package com.coocaa.aries.codegen.service;


import com.coocaa.aries.codegen.entity.ExtConfigTemplateInfoEntity;
import com.coocaa.aries.codegen.model.CodeGenConfigModel;
import com.coocaa.aries.codegen.model.TableInfoModel;
import com.coocaa.aries.codegen.model.query.DbTableQueryModel;
import com.coocaa.aries.codegen.model.query.ExtCodeGenConfigQueryModel;
import com.coocaa.aries.core.base.model.PageResultModel;
import com.coocaa.aries.core.base.model.R;

import javax.servlet.http.HttpServletResponse;

/**
 * @author : bijiahao
 * @date : 2019/4/20.
 * @description:
 */
public interface ICodeGenService {
    /**
     * 执行代码生成
     *
     * @param model
     */
    R execCodeGen(CodeGenConfigModel model) throws Exception;

    /**
     * 配置信息
     *
     * @return
     */
    R configInfo();

    /**
     * 下载生成的代码
     *
     * @param dir
     * @param response
     * @throws Exception
     */
    void downFile(String dir, HttpServletResponse response) throws Exception;

    /**
     * 获取表信息
     *
     * @param model
     * @return
     */
    PageResultModel<TableInfoModel> listTable(DbTableQueryModel model);

    /**
     * 获取配置模块信息
     *
     * @param model
     * @return
     */
    PageResultModel<ExtConfigTemplateInfoEntity> listConfigTemplate(ExtCodeGenConfigQueryModel model);

    /**
     * 校验数据库连接
     *
     * @param model
     * @return
     */
    R testDbConn(DbTableQueryModel model);

    /**
     * 保存配置模板
     *
     * @param entity
     */
    void saveConfigTemplate(ExtConfigTemplateInfoEntity entity);

}
